//Tpv-20181226 Create by zhongxiang.huang
$(function () {
	$("#meetingroom-upgrade .btn-close").click(function() {
	    $MB.closeModal("meetingroom-upgrade");
	});
	$("#meetingroom-upgrade .btn-confirm").click(function() {
	    $MB.closeModal("meetingroom-upgrade");
	});
});


function openMeetingroomUpgradeGuide(hardwareKey){
	var hardwareKey = hardwareKey;
	$.post(ctx + "meetingroom/getMeetingRoom", { "hardwareKey": hardwareKey }, function(r) {
	    if (r.code === 0) {
	        var meetingroom = r.msg;
//	        writeObj(meetingroom);
	        $('#maximum-concurrency').html(" - "+$MB.i18n('meetingroom.upgrade.guide.maximumconcurrency')+" : "+meetingroom.maxUsersAllowed);
	        if(strIsEmpty(meetingroom.expireTime)){
	        	$('#term-of-validity').html(" - "+$MB.i18n('meetingroom.upgrade.guide.termofvalidity')+" : ");
	        }else{
	        	$('#term-of-validity').html(" - "+$MB.i18n('meetingroom.upgrade.guide.termofvalidity')+" : "+meetingroom.expireTime);
	        }
	   	    $('#video-preservation-time').html("-  "+$MB.i18n('meetingroom.upgrade.guide.videopreservationtime')+" : ");
	   	    $('#video-quality').html(" - "+$MB.i18n('meetingroom.upgrade.guide.videoquality')+" : ");
	   	    $('#meetingroom-upgrade').modal();
	    } else {
	        $MB.n_danger(r.msg);
	    }
	});
}

function strIsEmpty(str){
    if (str == "" || str == null || typeof(str) == "undefined") {
        return true;
    }else{
        return false;
    }

}
 
function writeObj(obj){ 
    var description = ""; 
    for(var i in obj){ 
        var property=obj[i]; 
        description+=i+" = "+property+"\n"; 
    } 
    console.log("*******************writeObj***************"+description);
}